#include "../inc/map.h"
#include <iostream>

int main ( int _argc, char** _argv )
{
	if ( _argc < 3 || ( _argc > 3 && _argc != 6 ) )
	{
		if ( _argc == 2 && ( strcmp( _argv[1], "-h" ) == 0 || strcmp( _argv[1], "-help" ) == 0 ) )
		{
			cout<<"| "<<_argv[0]<<" :"<<endl;
			cout<<"| Improves a feature map contrast"<<endl;
			cout<<endl;
			cout<<"How to :"<<endl;
			cout<<"\t- input.txt : map you want to enhance contrast"<<endl;
			cout<<"\t- output.txt : file to save the resulting map"<<endl;
			cout<<"\t- -mode : function used to increase contrast. Can be '-exp' or '-cube'"<<endl;
			cout<<"Usage : "<<_argv[0]<<" input.txt output.txt [mode coeffSulcis coeffGyris]"<<endl;
		}
		
		else
			cout<<"Usage : "<<_argv[0]<<" input.txt output.txt [-mode coeffSulcis coeffGyris]"<<endl;
		
		return 0;
	}
	
	Map map;
	map.load( _argv[1] );
	
	if ( _argc > 3 )
	{
		if ( strcmp( _argv[3], "-exp" ) == 0 )
			map.increaseContrast( EXP, atof(_argv[4] ), atof( _argv[5] ) );
		
		if ( strcmp( _argv[3], "-cube" ) == 0 )
			map.increaseContrast( CUBE, atof(_argv[4] ), atof( _argv[5] ) );
	}
	
	else
		map.increaseContrast();
	
	map.save( _argv[2] );
	
	return 0;
}
	
